package br.com.northwind.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import br.com.northwind.interfaces.IConexao;

public class Conexao implements IConexao {
	
	private Connection con;
	
	public Conexao(){
	}

	public void abrirConexao() throws ClassNotFoundException, SQLException {
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=../JavaNorthwind/src/database/Northwind.mdb;DriverID=22;READONLY=true}","","");
	}

	public void fecharConexao() throws SQLException {
		if(con != null)
			con.close();
	}

	public Connection getConexao() {
		return con;
	}

}
